package com.wkq.main.ui.kotlin

import android.content.Context
import android.content.Intent
import com.wkq.base.activity.BasicVbActivity
import com.wkq.main.databinding.ActivityKotlinBinding
import com.wkq.main.databinding.ActivityMainBinding
import com.wkq.main.ui.MainActivity
import com.wkq.main.util.hide
import com.wkq.main.util.show
import com.wkq.util.setSafeClickListener

/**
 *
 *@Author: wkq
 *
 *@Time: 2025/8/25 9:22
 *
 *@Desc:
 */
class KotlinActivity : BasicVbActivity<ActivityKotlinBinding>() {

    companion object {
        fun startActivity(context: Context) {
            context.startActivity(Intent(context, KotlinActivity::class.java))
        }
    }

    var isShowView=false

    override fun initView() {

        binding.btBack.setSafeClickListener {
            finish()
        }

        binding.btExtendFunction.setSafeClickListener {
          if (isShowView){
              binding.llExtend.hide()
              isShowView=false
          }else{
              binding.llExtend.show()
              isShowView=true
          }
        }


    }

    override fun initData() {

    }

    /**
    *  高阶函数  (函数作为参数或者函数作为返回值的函数)
     */

    fun heightFunction(){
        val result= addHeight (1,3) { a,b-> a+b  }
    }
    // 普通函数
    fun add(a:Int,b:Int):Int{
        return a+b
    }

    fun addHeight(a:Int,b:Int ,add:(Int,Int)->Int):Int{
        return add(a,b)
    }
}